package cz.muni.fi.pv168.addressbook.gui;

import cz.muni.fi.pv168.addressbook.daos.impl.handler.ManagersHandler;
import cz.muni.fi.pv168.addressbook.entities.Person;
import cz.muni.fi.pv168.addressbook.gui.components.PersonJButton;
import cz.muni.fi.pv168.addressbook.gui.utils.DialogWindowsHandler;
import cz.muni.fi.pv168.addressbook.gui.utils.JOptionDialogWindowHandler;
import cz.muni.fi.pv168.addressbook.gui.utils.SwingWorkerOperationsEnum;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.Timer;

import static cz.muni.fi.pv168.addressbook.gui.utils.JOptionDialogWindowHandler.showErrorDialogWindow;
import static cz.muni.fi.pv168.addressbook.gui.utils.SwingWorkerOperationsEnum.FIND_CONTACT_OPERATION;
import static cz.muni.fi.pv168.addressbook.gui.utils.SwingWorkerOperationsEnum.FIND_PERSON_OPERATION;
import static cz.muni.fi.pv168.addressbook.gui.utils.SwingWorkerOperationsEnum.GET_ALL_PERSONS_OPERATION;
import static cz.muni.fi.pv168.addressbook.gui.utils.SwingWorkerOperationsEnum.REMOVE_PERSON_OPERATION;
import static java.util.Collections.emptyList;
import static java.util.ResourceBundle.getBundle;
import static java.util.logging.Logger.getLogger;

/**
 *
 * @author Michal Ďuriš
 */
public class MainWindow extends javax.swing.JFrame {

    public static final int ENGLISH = 1;
    public static final int SLOVAK = 2;
    public static final int FRENCH = 3;

    public static final int ADD_PERSON_DIALOG = 7;
    public static final int DETAIL_PERSON_DIALOG = 11;

    public static final String BUNDLE_PATH = "cz/muni/fi/pv168/addressbook/resources/lang/Bundle";

    private static final long serialVersionUID = 1L;

    private static final Logger LOGGER = Logger.getLogger(MainWindow.class
            .getName());

    private static final Locale SLOVAKIA = new Locale("sk", "SK");

    private boolean startAplication = true;

    private List<PersonJButton> personButtonsList = new ArrayList<>();

    private ManagersHandler managersHandler;

    /**
     * Creates new form MainWindow
     */
    public MainWindow() {
        initComponents();
        setLocationRelativeTo(null);

        selectLanguageInMenuFromDefaultLocale();
    }

    public void runApplication() {

        try {
            setClockToTimeMenu();
            activateTimer();

            managersHandler = ManagersHandler.getInstance();

            new mainWindowSwingWorker(
                    SwingWorkerOperationsEnum.GET_ALL_PERSONS_OPERATION)
                    .execute();

            startAplication = false;
            setVisible(true);

        } catch (Exception ex) {

            ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

            showErrorDialogWindow(MainWindow.this,
                    bundle.getString("ErrorMessage.Title"),
                    bundle.getString("ErrorMessage.initError"));

            LOGGER.logp(Level.SEVERE, getClass().getName(), "init()", bundle
                    .getString("ErrorMessage.initError"), ex);

            closeProgram(1);
        }
    }

    private class mainWindowSwingWorker extends SwingWorker< List<Person>, Void> {

        private SwingWorkerOperationsEnum operation;

        private PersonJButton personToRemoveFromAddressBook = null;

        private String searchString = null;

        public mainWindowSwingWorker(SwingWorkerOperationsEnum operation) {
            this.operation = operation;
        }

        public void setOperation(SwingWorkerOperationsEnum operation) {
            this.operation = operation;
        }

        public void setPersonToRemoveFromAddressBook(
                PersonJButton personToRemoveFromAddressBook) {
            this.personToRemoveFromAddressBook = personToRemoveFromAddressBook;
        }

        public void setSearchString(String searchString) {
            this.searchString = searchString;
        }

        @Override
        protected List<Person> doInBackground() throws Exception {

            switch (operation) {
                case GET_ALL_PERSONS_OPERATION:
                    return managersHandler.getAllPersons();

                case FIND_PERSON_OPERATION:
                    return managersHandler.findPerson(
                            searchString);

                case FIND_CONTACT_OPERATION:
                    return managersHandler.findContact(
                            searchString);

                case REMOVE_PERSON_OPERATION:
                    managersHandler.deletePerson(
                            personToRemoveFromAddressBook
                            .getPerson());
                    break;

                default:
                    throw new IllegalStateException(
                            "UNRECOGNIZED SWING WORKER OPERATION");
            }

            return emptyList();
        }

        @Override
        protected void done() {

            try {
                List<Person> personsList = get();

                switch (operation) {
                    case GET_ALL_PERSONS_OPERATION:
                        showPersonList(personsList);
                        break;
                    case FIND_PERSON_OPERATION:
                        handleSearchResult(personsList);
                        break;
                    case FIND_CONTACT_OPERATION:
                        handleSearchResult(personsList);
                        break;
                    case REMOVE_PERSON_OPERATION:
                        deletePersonFromAddressBook(
                                personToRemoveFromAddressBook);
                        break;

                    default:
                        ResourceBundle bundle = getBundle(BUNDLE_PATH);

                        getLogger(MainWindow.class.getName()).logp(Level.SEVERE,
                                this.getClass().getName(),
                                "done()",
                                bundle.getString(
                                        "ErrorMessage.swingWorkerBadOperation"));

                        showErrorDialogWindow(MainWindow.this,
                                bundle.getString("ErrorMessage.Title"),
                                bundle.getString(
                                        "ErrorMessage.swingWorkerBadOperation"));

                }
            } catch (InterruptedException | ExecutionException ex) {

                ResourceBundle bundle = getBundle(BUNDLE_PATH);
                String errorMessage;

                switch (operation) {
                    case GET_ALL_PERSONS_OPERATION:
                        errorMessage = bundle.getString(
                                "ErrorMessage.loadPersons");
                        break;
                    case FIND_PERSON_OPERATION:
                        errorMessage = bundle.getString(
                                "ErrorMessage.findPerson");
                        break;
                    case FIND_CONTACT_OPERATION:
                        errorMessage = bundle.getString(
                                "ErrorMessage.findContact");
                        break;
                    case REMOVE_PERSON_OPERATION:
                        errorMessage = bundle.getString(
                                "ErrorMessage.removePerson");
                        break;

                    default:
                        errorMessage = bundle.getString(
                                "ErrorMessage.swingWorkerBadOperation");
                }

                getLogger(MainWindow.class.getName()).log(Level.SEVERE,
                        errorMessage, ex);

                showErrorDialogWindow(MainWindow.this, bundle.getString(
                        "ErrorMessage.Title"), errorMessage);

                if (operation == SwingWorkerOperationsEnum.GET_ALL_PERSONS_OPERATION) {
                    closeProgram(1);
                }
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        languageButtonGroup = new javax.swing.ButtonGroup();
        addressBookToolBar = new javax.swing.JToolBar();
        addPersonButton = new javax.swing.JButton();
        changePersonButton = new javax.swing.JButton();
        removeButton = new javax.swing.JButton();
        personActionSeparator = new javax.swing.JToolBar.Separator();
        findPersonButton = new javax.swing.JButton();
        findContactButton = new javax.swing.JButton();
        personsScrollPane = new javax.swing.JScrollPane();
        personsPanel = new javax.swing.JPanel();
        addressBookMenuBar = new javax.swing.JMenuBar();
        programMenu = new javax.swing.JMenu();
        exitMenuItem = new javax.swing.JMenuItem();
        actionMenu = new javax.swing.JMenu();
        addMenu = new javax.swing.JMenu();
        addPersonMenuItem = new javax.swing.JMenuItem();
        addContactMenuItem = new javax.swing.JMenuItem();
        updateMenu = new javax.swing.JMenu();
        changePersonMenuItem = new javax.swing.JMenuItem();
        removeMenu = new javax.swing.JMenu();
        removePersonMenuItem = new javax.swing.JMenuItem();
        findMenu = new javax.swing.JMenu();
        findPersonMenuItem = new javax.swing.JMenuItem();
        findContactMenuItem = new javax.swing.JMenuItem();
        languageMenu = new javax.swing.JMenu();
        defaultLanguageRadioButtonMenuItem = new javax.swing.JRadioButtonMenuItem();
        slovakLanguageRadioButtonMenuItem = new javax.swing.JRadioButtonMenuItem();
        frenchLanguageRadioButtonMenuItem = new javax.swing.JRadioButtonMenuItem();
        timeMenu = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("cz/muni/fi/pv168/addressbook/resources/lang/Bundle"); // NOI18N
        setTitle(bundle.getString("MainWindow.title")); // NOI18N
        setIconImage(new ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/window/Address-Book-icon.png")).getImage());
        setName(bundle.getString("MainWindow.name")); // NOI18N

        addressBookToolBar.setFloatable(false);
        addressBookToolBar.setRollover(true);

        addPersonButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/buttons/Add-user-icon.png"))); // NOI18N
        addPersonButton.setText(bundle.getString("MainWindow.addPersonButton.text")); // NOI18N
        addPersonButton.setToolTipText(bundle.getString("MainWindow.addPersonButton.toolTipText")); // NOI18N
        addPersonButton.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        addPersonButton.setFocusable(false);
        addPersonButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        addPersonButton.setMaximumSize(new java.awt.Dimension(45, 40));
        addPersonButton.setMinimumSize(new java.awt.Dimension(45, 40));
        addPersonButton.setPreferredSize(new java.awt.Dimension(45, 40));
        addPersonButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        addPersonButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPersonButtonActionPerformed(evt);
            }
        });
        addressBookToolBar.add(addPersonButton);

        changePersonButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/buttons/Edit-user-icon.png"))); // NOI18N
        changePersonButton.setText(bundle.getString("MainWindow.changePersonButton.text")); // NOI18N
        changePersonButton.setToolTipText(bundle.getString("MainWindow.changePersonButton.toolTipText")); // NOI18N
        changePersonButton.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        changePersonButton.setFocusable(false);
        changePersonButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        changePersonButton.setMaximumSize(new java.awt.Dimension(45, 40));
        changePersonButton.setMinimumSize(new java.awt.Dimension(45, 40));
        changePersonButton.setPreferredSize(new java.awt.Dimension(45, 40));
        changePersonButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        changePersonButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                changePersonButtonActionPerformed(evt);
            }
        });
        addressBookToolBar.add(changePersonButton);

        removeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/buttons/Remove-user-icon.png"))); // NOI18N
        removeButton.setText(bundle.getString("MainWindow.removeButton.text")); // NOI18N
        removeButton.setToolTipText(bundle.getString("MainWindow.removeButton.toolTipText")); // NOI18N
        removeButton.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        removeButton.setFocusable(false);
        removeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        removeButton.setMaximumSize(new java.awt.Dimension(45, 40));
        removeButton.setMinimumSize(new java.awt.Dimension(45, 40));
        removeButton.setPreferredSize(new java.awt.Dimension(45, 40));
        removeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        removeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeButtonActionPerformed(evt);
            }
        });
        addressBookToolBar.add(removeButton);
        addressBookToolBar.add(personActionSeparator);

        findPersonButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/buttons/Find-user-icon.png"))); // NOI18N
        findPersonButton.setText(bundle.getString("MainWindow.findPersonButton.text")); // NOI18N
        findPersonButton.setToolTipText(bundle.getString("MainWindow.findPersonButton.toolTipText")); // NOI18N
        findPersonButton.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        findPersonButton.setFocusable(false);
        findPersonButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        findPersonButton.setMaximumSize(new java.awt.Dimension(45, 40));
        findPersonButton.setMinimumSize(new java.awt.Dimension(45, 40));
        findPersonButton.setPreferredSize(new java.awt.Dimension(45, 40));
        findPersonButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        findPersonButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findPersonButtonActionPerformed(evt);
            }
        });
        addressBookToolBar.add(findPersonButton);

        findContactButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/buttons/Find-contact-icon.png"))); // NOI18N
        findContactButton.setToolTipText(bundle.getString("MainWindow.findContactButton.toolTipText")); // NOI18N
        findContactButton.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        findContactButton.setFocusable(false);
        findContactButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        findContactButton.setMaximumSize(new java.awt.Dimension(45, 40));
        findContactButton.setMinimumSize(new java.awt.Dimension(45, 40));
        findContactButton.setPreferredSize(new java.awt.Dimension(45, 40));
        findContactButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        findContactButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findContactButtonActionPerformed(evt);
            }
        });
        addressBookToolBar.add(findContactButton);

        personsScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder(null, bundle.getString("MainWindow.personsScrollPane.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 102, 255))); // NOI18N
        personsScrollPane.setToolTipText(bundle.getString("MainWindow.personsScrollPane.toolTipText")); // NOI18N

        personsPanel.setLayout(new javax.swing.BoxLayout(personsPanel, javax.swing.BoxLayout.PAGE_AXIS));
        personsScrollPane.setViewportView(personsPanel);

        programMenu.setForeground(new java.awt.Color(0, 102, 255));
        programMenu.setText(bundle.getString("MainWindow.programMenu.text")); // NOI18N
        programMenu.setToolTipText(bundle.getString("MainWindow.programMenu.toolTipText")); // NOI18N

        exitMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        exitMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/App-shutdown-icon.png"))); // NOI18N
        exitMenuItem.setText(bundle.getString("MainWindow.exitMenuItem.text")); // NOI18N
        exitMenuItem.setToolTipText(bundle.getString("MainWindow.exitMenuItem.toolTipText")); // NOI18N
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        programMenu.add(exitMenuItem);

        addressBookMenuBar.add(programMenu);

        actionMenu.setForeground(new java.awt.Color(0, 102, 255));
        actionMenu.setText(bundle.getString("MainWindow.actionMenu.text")); // NOI18N

        addMenu.setForeground(new java.awt.Color(0, 102, 255));
        addMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Add-icon.png"))); // NOI18N
        addMenu.setText(bundle.getString("MainWindow.addMenu.text")); // NOI18N

        addPersonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        addPersonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/User-icon.png"))); // NOI18N
        addPersonMenuItem.setText(bundle.getString("MainWindow.addPersonMenuItem.text")); // NOI18N
        addPersonMenuItem.setToolTipText(bundle.getString("MainWindow.addPersonMenuItem.toolTipText")); // NOI18N
        addPersonMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPersonMenuItemActionPerformed(evt);
            }
        });
        addMenu.add(addPersonMenuItem);

        addContactMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        addContactMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Misc-Address-Book-icon.png"))); // NOI18N
        addContactMenuItem.setText(bundle.getString("MainWindow.addContactMenuItem.text")); // NOI18N
        addContactMenuItem.setToolTipText(bundle.getString("MainWindow.addContactMenuItem.toolTipText")); // NOI18N
        addContactMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addContactMenuItemActionPerformed(evt);
            }
        });
        addMenu.add(addContactMenuItem);

        actionMenu.add(addMenu);

        updateMenu.setForeground(new java.awt.Color(0, 102, 255));
        updateMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Change-pencil-icon.png"))); // NOI18N
        updateMenu.setText(bundle.getString("MainWindow.updateMenu.text")); // NOI18N

        changePersonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        changePersonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/User-icon.png"))); // NOI18N
        changePersonMenuItem.setText(bundle.getString("MainWindow.changePersonMenuItem.text")); // NOI18N
        changePersonMenuItem.setToolTipText(bundle.getString("MainWindow.changePersonMenuItem.toolTipText")); // NOI18N
        changePersonMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                changePersonMenuItemActionPerformed(evt);
            }
        });
        updateMenu.add(changePersonMenuItem);

        actionMenu.add(updateMenu);

        removeMenu.setForeground(new java.awt.Color(0, 102, 255));
        removeMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Button-Remove-icon.png"))); // NOI18N
        removeMenu.setText(bundle.getString("MainWindow.removeMenu.text")); // NOI18N

        removePersonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        removePersonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/User-icon.png"))); // NOI18N
        removePersonMenuItem.setText(bundle.getString("MainWindow.removePersonMenuItem.text")); // NOI18N
        removePersonMenuItem.setToolTipText(bundle.getString("MainWindow.removePersonMenuItem.toolTipText")); // NOI18N
        removePersonMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removePersonMenuItemActionPerformed(evt);
            }
        });
        removeMenu.add(removePersonMenuItem);

        actionMenu.add(removeMenu);

        findMenu.setForeground(new java.awt.Color(0, 102, 255));
        findMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Find-icon.png"))); // NOI18N
        findMenu.setText(bundle.getString("MainWindow.findMenu.text")); // NOI18N

        findPersonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        findPersonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/User-icon.png"))); // NOI18N
        findPersonMenuItem.setText(bundle.getString("MainWindow.findPersonMenuItem.text")); // NOI18N
        findPersonMenuItem.setToolTipText(bundle.getString("MainWindow.findPersonMenuItem.toolTipText")); // NOI18N
        findPersonMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findPersonMenuItemActionPerformed(evt);
            }
        });
        findMenu.add(findPersonMenuItem);

        findContactMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        findContactMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Misc-Address-Book-icon.png"))); // NOI18N
        findContactMenuItem.setText(bundle.getString("MainWindow.findContactMenuItem.text")); // NOI18N
        findContactMenuItem.setToolTipText(bundle.getString("MainWindow.findContactMenuItem.toolTipText")); // NOI18N
        findContactMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findContactMenuItemActionPerformed(evt);
            }
        });
        findMenu.add(findContactMenuItem);

        actionMenu.add(findMenu);

        addressBookMenuBar.add(actionMenu);

        languageMenu.setForeground(new java.awt.Color(0, 102, 255));
        languageMenu.setText(bundle.getString("MainWindow.languageMenu.text")); // NOI18N

        languageButtonGroup.add(defaultLanguageRadioButtonMenuItem);
        defaultLanguageRadioButtonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        defaultLanguageRadioButtonMenuItem.setSelected(true);
        defaultLanguageRadioButtonMenuItem.setText(bundle.getString("MainWindow.defaultLanguageRadioButtonMenuItem.text")); // NOI18N
        defaultLanguageRadioButtonMenuItem.setToolTipText(bundle.getString("MainWindow.defaultLanguageRadioButtonMenuItem.toolTipText")); // NOI18N
        defaultLanguageRadioButtonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/United-Kingdom-flag-icon.png"))); // NOI18N
        defaultLanguageRadioButtonMenuItem.setName(bundle.getString("MainWindow.defaultLanguageRadioButtonMenuItem.name")); // NOI18N
        defaultLanguageRadioButtonMenuItem.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                defaultLanguageRadioButtonMenuItemItemStateChanged(evt);
            }
        });
        languageMenu.add(defaultLanguageRadioButtonMenuItem);

        languageButtonGroup.add(slovakLanguageRadioButtonMenuItem);
        slovakLanguageRadioButtonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        slovakLanguageRadioButtonMenuItem.setText(bundle.getString("MainWindow.slovakLanguageRadioButtonMenuItem.text")); // NOI18N
        slovakLanguageRadioButtonMenuItem.setToolTipText(bundle.getString("MainWindow.slovakLanguageRadioButtonMenuItem.toolTipText")); // NOI18N
        slovakLanguageRadioButtonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/Slovakia-Flag-icon.png"))); // NOI18N
        slovakLanguageRadioButtonMenuItem.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                slovakLanguageRadioButtonMenuItemItemStateChanged(evt);
            }
        });
        languageMenu.add(slovakLanguageRadioButtonMenuItem);

        languageButtonGroup.add(frenchLanguageRadioButtonMenuItem);
        frenchLanguageRadioButtonMenuItem.setForeground(new java.awt.Color(0, 102, 255));
        frenchLanguageRadioButtonMenuItem.setText(bundle.getString("MainWindow.frenchLanguageRadioButtonMenuItem.text")); // NOI18N
        frenchLanguageRadioButtonMenuItem.setToolTipText(bundle.getString("MainWindow.frenchLanguageRadioButtonMenuItem.toolTipText")); // NOI18N
        frenchLanguageRadioButtonMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/muni/fi/pv168/addressbook/resources/icons/menu/France-Flag-icon.png"))); // NOI18N
        frenchLanguageRadioButtonMenuItem.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                frenchLanguageRadioButtonMenuItemItemStateChanged(evt);
            }
        });
        languageMenu.add(frenchLanguageRadioButtonMenuItem);

        addressBookMenuBar.add(languageMenu);

        timeMenu.setEnabled(false);

        addressBookMenuBar.add(Box.createHorizontalGlue());

        addressBookMenuBar.add(timeMenu);

        setJMenuBar(addressBookMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addressBookToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(personsScrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(addressBookToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(personsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        closeProgram(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void defaultLanguageRadioButtonMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_defaultLanguageRadioButtonMenuItemItemStateChanged
        if (defaultLanguageRadioButtonMenuItem.isSelected() && !startAplication) {
            setNewDefaultLocaleAndInicializateComponents(Locale.UK);
        }
    }//GEN-LAST:event_defaultLanguageRadioButtonMenuItemItemStateChanged

    private void slovakLanguageRadioButtonMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_slovakLanguageRadioButtonMenuItemItemStateChanged
        if (slovakLanguageRadioButtonMenuItem.isSelected() && !startAplication) {
            setNewDefaultLocaleAndInicializateComponents(SLOVAKIA);
        }
    }//GEN-LAST:event_slovakLanguageRadioButtonMenuItemItemStateChanged

    private void frenchLanguageRadioButtonMenuItemItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_frenchLanguageRadioButtonMenuItemItemStateChanged
        if (frenchLanguageRadioButtonMenuItem.isSelected() && !startAplication) {
            setNewDefaultLocaleAndInicializateComponents(Locale.FRANCE);
        }
    }//GEN-LAST:event_frenchLanguageRadioButtonMenuItemItemStateChanged

    private void addPersonButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPersonButtonActionPerformed
        showAddPersonDialogWindow();
    }//GEN-LAST:event_addPersonButtonActionPerformed

    private void addPersonMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPersonMenuItemActionPerformed
        showAddPersonDialogWindow();
    }//GEN-LAST:event_addPersonMenuItemActionPerformed

    private void changePersonButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changePersonButtonActionPerformed
        if (!personButtonsList.isEmpty()) {
            choosePersonToChange();
        }
    }//GEN-LAST:event_changePersonButtonActionPerformed

    private void changePersonMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changePersonMenuItemActionPerformed
        if (!personButtonsList.isEmpty()) {
            choosePersonToChange();
        }
    }//GEN-LAST:event_changePersonMenuItemActionPerformed

    private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
        if (!personButtonsList.isEmpty()) {
            choosePersonToRemove();
        }
    }//GEN-LAST:event_removeButtonActionPerformed

    private void removePersonMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removePersonMenuItemActionPerformed
        if (!personButtonsList.isEmpty()) {
            choosePersonToRemove();
        }
    }//GEN-LAST:event_removePersonMenuItemActionPerformed

    private void findPersonButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findPersonButtonActionPerformed
        if (!personButtonsList.isEmpty()) {
            findPerson();
        }
    }//GEN-LAST:event_findPersonButtonActionPerformed

    private void findPersonMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findPersonMenuItemActionPerformed
        if (!personButtonsList.isEmpty()) {
            findPerson();
        }
    }//GEN-LAST:event_findPersonMenuItemActionPerformed

    private void findContactButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findContactButtonActionPerformed
        if (!personButtonsList.isEmpty()) {
            findContact();
        }
    }//GEN-LAST:event_findContactButtonActionPerformed

    private void findContactMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findContactMenuItemActionPerformed
        if (!personButtonsList.isEmpty()) {
            findContact();
        }
    }//GEN-LAST:event_findContactMenuItemActionPerformed

    private void addContactMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addContactMenuItemActionPerformed
        if (!personButtonsList.isEmpty()) {
            choosePersonToChange();
        }
    }//GEN-LAST:event_addContactMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info
                    : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException |
                 IllegalAccessException |
                 javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(
                    java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(() -> {
            new MainWindow().runApplication();
        });
    }

    private void selectLanguageInMenuFromDefaultLocale() {
        Locale defaultLocale = Locale.getDefault();

        if (defaultLocale.getLanguage().equals(new Locale("sk").getLanguage())) {
            slovakLanguageRadioButtonMenuItem.setSelected(true);
        } else if (defaultLocale.getLanguage().equals(new Locale("fr")
                .getLanguage())) {

            frenchLanguageRadioButtonMenuItem.setSelected(true);
        }
    }

    private void setNewDefaultLocaleAndInicializateComponents(
            Locale selectedLanguage) {
        Locale.setDefault(selectedLanguage);
        changeLanguageInAplication();
    }

    private void changeLanguageInAplication() {
        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        setTitle(bundle.getString("MainWindow.title")); // NOI18N
        setName(bundle.getString("MainWindow.name")); // NOI18N
        addPersonButton.setText(bundle.getString(
                "MainWindow.addPersonButton.text")); // NOI18N
        addPersonButton.setToolTipText(bundle.getString(
                "MainWindow.addPersonButton.toolTipText")); // NOI18N
        changePersonButton.setText(bundle.getString(
                "MainWindow.changePersonButton.text")); // NOI18N
        changePersonButton.setToolTipText(bundle.getString(
                "MainWindow.changePersonButton.toolTipText")); // NOI18N
        removeButton.setText(bundle.getString("MainWindow.removeButton.text")); // NOI18N
        removeButton.setToolTipText(bundle.getString(
                "MainWindow.removeButton.toolTipText")); // NOI18N
        findPersonButton.setText(bundle.getString(
                "MainWindow.findPersonButton.text")); // NOI18N
        findPersonButton.setToolTipText(bundle.getString(
                "MainWindow.findPersonButton.toolTipText")); // NOI18N
        findContactButton.setToolTipText(bundle.getString(
                "MainWindow.findContactButton.toolTipText")); // NOI18N
        personsScrollPane.setBorder(javax.swing.BorderFactory
                .createTitledBorder(null, bundle.getString(
                                "MainWindow.personsScrollPane.border.title"),
                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                        javax.swing.border.TitledBorder.DEFAULT_POSITION,
                        new java.awt.Font("Tahoma", 1, 14),
                        new java.awt.Color(0, 102, 255))); // NOI18N
        personsScrollPane.setToolTipText(bundle.getString(
                "MainWindow.personsScrollPane.toolTipText")); // NOI18N

        changeLanguageInPersonButtons(bundle);

        programMenu.setText(bundle.getString("MainWindow.programMenu.text")); // NOI18N
        programMenu.setToolTipText(bundle.getString(
                "MainWindow.programMenu.toolTipText")); // NOI18N
        exitMenuItem.setText(bundle.getString("MainWindow.exitMenuItem.text")); // NOI18N
        actionMenu.setText(bundle.getString("MainWindow.actionMenu.text")); // NOI18N
        exitMenuItem.setToolTipText(bundle.getString(
                "MainWindow.exitMenuItem.toolTipText")); // NOI18N
        addMenu.setText(bundle.getString("MainWindow.addMenu.text")); // NOI18N
        addPersonMenuItem.setText(bundle.getString(
                "MainWindow.addPersonMenuItem.text")); // NOI18N
        addPersonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.addPersonMenuItem.toolTipText")); // NOI18N
        addContactMenuItem.setText(bundle.getString(
                "MainWindow.addContactMenuItem.text")); // NOI18N
        updateMenu.setText(bundle.getString("MainWindow.updateMenu.text")); // NOI18N
        addContactMenuItem.setToolTipText(bundle.getString(
                "MainWindow.addContactMenuItem.toolTipText")); // NOI18N
        changePersonMenuItem.setText(bundle.getString(
                "MainWindow.changePersonMenuItem.text")); // NOI18N
        changePersonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.changePersonMenuItem.toolTipText")); // NOI18N
        removeMenu.setText(bundle.getString("MainWindow.removeMenu.text")); // NOI18N
        removePersonMenuItem.setText(bundle.getString(
                "MainWindow.removePersonMenuItem.text")); // NOI18N
        removePersonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.removePersonMenuItem.toolTipText")); // NOI18N
        findMenu.setText(bundle.getString("MainWindow.findMenu.text")); // NOI18N
        findPersonMenuItem.setText(bundle.getString(
                "MainWindow.findPersonMenuItem.text")); // NOI18N
        findPersonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.findPersonMenuItem.toolTipText")); // NOI18N
        findContactMenuItem.setText(bundle.getString(
                "MainWindow.findContactMenuItem.text")); // NOI18N
        findContactMenuItem.setToolTipText(bundle.getString(
                "MainWindow.findContactMenuItem.toolTipText")); // NOI18N
        languageMenu.setText(bundle.getString("MainWindow.languageMenu.text")); // NOI18N
        defaultLanguageRadioButtonMenuItem.setText(bundle.getString(
                "MainWindow.defaultLanguageRadioButtonMenuItem.text")); // NOI18N
        defaultLanguageRadioButtonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.defaultLanguageRadioButtonMenuItem.toolTipText")); // NOI18N
        defaultLanguageRadioButtonMenuItem.setName(bundle.getString(
                "MainWindow.defaultLanguageRadioButtonMenuItem.name")); // NOI18N
        slovakLanguageRadioButtonMenuItem.setText(bundle.getString(
                "MainWindow.slovakLanguageRadioButtonMenuItem.text")); // NOI18N
        slovakLanguageRadioButtonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.slovakLanguageRadioButtonMenuItem.toolTipText")); // NOI18N
        frenchLanguageRadioButtonMenuItem.setText(bundle.getString(
                "MainWindow.frenchLanguageRadioButtonMenuItem.text")); // NOI18N
        frenchLanguageRadioButtonMenuItem.setToolTipText(bundle.getString(
                "MainWindow.frenchLanguageRadioButtonMenuItem.toolTipText")); // NOI18N

        DialogWindowsHandler.changeLanguageInAllDialogWindows();
    }

    private void changeLanguageInPersonButtons(ResourceBundle bundle) {

        personButtonsList.stream()
                .forEach(
                        (cz.muni.fi.pv168.addressbook.gui.components.PersonJButton personJButton) -> {
                            personJButton.setToolTipText(bundle.getString(
                                            "MainWindow.personButton.toolTipText"));
                        });
    }

    private void setClockToTimeMenu() {
        timeMenu
                .setText(new SimpleDateFormat().format(Date.from(Instant.now())));
    }

    private void activateTimer() {
        new Timer(1000, (ActionEvent e) -> {
            setClockToTimeMenu();
        }).start();
    }

    private void showPersonList(List<Person> personsList) {
        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        personsList.stream()
                .map((person) -> createPersonJButton(person, bundle))
                .forEach(
                        (cz.muni.fi.pv168.addressbook.gui.components.PersonJButton personButton) -> {
                            personsPanel.add(personButton);
                            personButtonsList.add(personButton);
                        });

        validate();
    }

    private PersonJButton createPersonJButton(Person person,
                                              ResourceBundle bundle) {

        PersonJButton personButton = new PersonJButton();

        personButton.setSettingsWithInternationalization(bundle);
        personButton.setPerson(person);

        personButton.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {

                if (person != null) {

                    if (e.getButton() == MouseEvent.BUTTON1) {

                        showDetailDialogWindowForPerson(person);

                    } else if (e.getButton() == MouseEvent.BUTTON3) {

                        confirmAndDelegateDeletePersonFromAddressBookToSwingWorker(
                                personButton);
                    }
                }
            }

        });

        return personButton;
    }

    void addPersonToPersonList(Person person) {

        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        PersonJButton personButton = createPersonJButton(person, bundle);

        personsPanel.add(personButton);
        personButtonsList.add(personButton);

        validate();
    }

    private void showDetailDialogWindowForPerson(Person person) {
        new DetailDialogWindow(MainWindow.this, false).runPersonDialogWindow(
                person, managersHandler, DETAIL_PERSON_DIALOG);
    }

    private void showAddPersonDialogWindow() {
        new DetailDialogWindow(MainWindow.this, false).runPersonDialogWindow(
                null, managersHandler, ADD_PERSON_DIALOG);
    }

    private void choosePersonToChange() {

        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        PersonJButton personJButton = (PersonJButton) JOptionDialogWindowHandler
                .showSelectBoxDialogWindow(this, bundle.getString(
                                "OptionMessage.Title.change"), bundle.getString(
                                "OptionMessage.Text.personChoose"),
                        personButtonsList.toArray());

        if (personJButton != null) {
            showDetailDialogWindowForPerson(personJButton.getPerson());
        }
    }

    private void choosePersonToRemove() {
        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        PersonJButton personJButton = (PersonJButton) JOptionDialogWindowHandler
                .showSelectBoxDialogWindow(this, bundle.getString(
                                "OptionMessage.Title.remove"), bundle.getString(
                                "OptionMessage.Text.personChoose"),
                        personButtonsList.toArray());

        if (personJButton != null) {
            confirmAndDelegateDeletePersonFromAddressBookToSwingWorker(
                    personJButton);
        }
    }

    private void confirmAndDelegateDeletePersonFromAddressBookToSwingWorker(
            PersonJButton person) {

        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        String title = bundle.getString("OptionMessage.Title.remove") + " " + person
                .toString();

        if (JOptionDialogWindowHandler.showYesNoDialogWindow(this, title, bundle
                .getString("OptionMessage.Text.personRemoveConfirm")) == JOptionPane.YES_OPTION) {

            mainWindowSwingWorker windowSwingWorker = new mainWindowSwingWorker(
                    SwingWorkerOperationsEnum.REMOVE_PERSON_OPERATION);

            windowSwingWorker.setPersonToRemoveFromAddressBook(person);
            windowSwingWorker.execute();
        }
    }

    private void deletePersonFromAddressBook(PersonJButton person) {

        personsPanel.remove(person);
        personButtonsList.remove(person);

        DialogWindowsHandler.closeAllDialogWindowsOfPerson(person.getPerson());

        validate();
        repaint();
    }

    private void findPerson() {
        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        String lastNameSearchString = JOptionDialogWindowHandler
                .showInputDialogWindow(this,
                        bundle.getString("InputMessage.Title.Find"),
                        bundle.getString("InputMessage.Text.findPerson"),
                        null, null);

        if (lastNameSearchString != null && lastNameSearchString.length() > 0) {
            if (lastNameSearchString.length() <= 30) {

                mainWindowSwingWorker windowSwingWorker = new mainWindowSwingWorker(
                        SwingWorkerOperationsEnum.FIND_PERSON_OPERATION);
                windowSwingWorker.setSearchString(lastNameSearchString);
                windowSwingWorker.execute();
            }
        }
    }

    private void findContact() {

        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        String contactSearchString = JOptionDialogWindowHandler
                .showInputDialogWindow(this,
                        bundle.getString("InputMessage.Title.Find"),
                        bundle.getString("InputMessage.Text.findContact"),
                        null, null);

        if (contactSearchString != null && contactSearchString.length() > 0) {
            if (contactSearchString.length() <= 50) {

                mainWindowSwingWorker windowSwingWorker = new mainWindowSwingWorker(
                        SwingWorkerOperationsEnum.FIND_CONTACT_OPERATION);

                windowSwingWorker.setSearchString(contactSearchString);
                windowSwingWorker.execute();
            }
        }
    }

    private void handleSearchResult(List<Person> personsList) {

        ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PATH);

        if (personsList.isEmpty()) {
            JOptionDialogWindowHandler.showInfoDialogWindow(this, bundle
                    .getString("OptionMessage.Title.findResult"), bundle
                    .getString("InfoMessage.nothingFound"));
        } else {

            PersonJButton personJButton;
            List<PersonJButton> personJButtonsList = new ArrayList<>();

            for (Person person : personsList) {

                personJButton = createPersonJButton(person, bundle);

                personJButtonsList.add(personJButton);
            }

            if (!personJButtonsList.isEmpty()) {

                personJButton = (PersonJButton) JOptionDialogWindowHandler
                        .showSelectBoxDialogWindow(this, bundle.getString(
                                        "OptionMessage.Title.findResult"),
                                bundle.getString(
                                        "OptionMessage.Text.personChoose"),
                                personJButtonsList.toArray());

                if (personJButton != null) {
                    showDetailDialogWindowForPerson(personJButton.getPerson());
                }
            }
        }
    }

    private void closeProgram(int status) {
        System.exit(status);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu actionMenu;
    private javax.swing.JMenuItem addContactMenuItem;
    private javax.swing.JMenu addMenu;
    private javax.swing.JButton addPersonButton;
    private javax.swing.JMenuItem addPersonMenuItem;
    private javax.swing.JMenuBar addressBookMenuBar;
    private javax.swing.JToolBar addressBookToolBar;
    private javax.swing.JButton changePersonButton;
    private javax.swing.JMenuItem changePersonMenuItem;
    private javax.swing.JRadioButtonMenuItem defaultLanguageRadioButtonMenuItem;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JButton findContactButton;
    private javax.swing.JMenuItem findContactMenuItem;
    private javax.swing.JMenu findMenu;
    private javax.swing.JButton findPersonButton;
    private javax.swing.JMenuItem findPersonMenuItem;
    private javax.swing.JRadioButtonMenuItem frenchLanguageRadioButtonMenuItem;
    private javax.swing.ButtonGroup languageButtonGroup;
    private javax.swing.JMenu languageMenu;
    private javax.swing.JToolBar.Separator personActionSeparator;
    private javax.swing.JPanel personsPanel;
    private javax.swing.JScrollPane personsScrollPane;
    private javax.swing.JMenu programMenu;
    private javax.swing.JButton removeButton;
    private javax.swing.JMenu removeMenu;
    private javax.swing.JMenuItem removePersonMenuItem;
    private javax.swing.JRadioButtonMenuItem slovakLanguageRadioButtonMenuItem;
    private javax.swing.JMenu timeMenu;
    private javax.swing.JMenu updateMenu;
    // End of variables declaration//GEN-END:variables
}
